{include file="Public/head" title="绑定银行卡-股票配资" keywords="股票配资" description="股票配资" /}

	<link href="/Public/wapsec/css/mui.picker.min.css" rel="stylesheet" type="text/css"/>
	<div id="offCanvasWrapper" class="mui-off-canvas-wrap mui-draggable">
		<!-- 菜单容器 -->
			{include file="Public/header"}
			
			<div class="mui-inner-wrap">
				<div id="offCanvasContentScroll" class="mui-content mui-scroll-wrapper" style="background-color: #fff;">
					<div class="mui-scroll">
						<header class="tx_head">
							<p>
								<a href="javascript:history.go(-1)" class="header_p1"><span class="mui-icon mui-icon-arrowleft"></span></a>
								<h5>绑定银行卡</h5>
								<a id="offCanvasBtn" href="#offCanvasSide" class="mui-icon mui-action-menu mui-icon-bars mui-pull-right" style="color:#fff;"></a>
							</p>
						</header>
						<main>
							<article class="bdyhk_a">
								<section class="bdyhk_a_s">
									<h4>绑定银行卡</h4>
									<h5>请填写银行卡的详细信息</h5>
								</section>
								<ul class="bdyhk_a_ul">
									<li>姓名　{if condition="$user['realName'] eq ''"}<span> 您尚未实名认证</span> <a style="color:red" href="{:url('Setting/renzheng')}">马上认证</a>{else /}{$user['realName']}{/if}</li>
									<li>卡号　<input style="width: 280px;" type="text" id="yhpd" value="{$user['bankCode']}" placeholder="请输入卡号"/></li>
									<div class="tjyhk_huise"><span id="yhtb"></span><span id="yhlx"></span></div><div style="clear:both"></div>
									
									<li>开户银行　
									<select class="select" id="bankCode" name="addBankCode" style="width:200px;height:40px;border: 1px solid #EAEAEA !important;appearance: normal;">
																
                                        {volist name="tag" id="v"}
												{if condition="$v['id'] eq $user['bankId']"}
	                                                <option value="{$v['id']}" selected="selected">{$v['title']}</option>
	                                            {else /}
	                                                <option value="{$v['id']}">{$v['title']}</option>
	                                        {/if}
	                                    {/volist}
                                                                                                             
                                    </select>
									</li>

									<li>支行名称 <input type="text" id="zhihang" value="{$user['bankAddress']}" placeholder="例:深圳坪洲支行"/></li>

									<li>所在省　
										<select class="select" id="pro_china" name="ProvinceId" style="width:200px;height:40px;border: 1px solid #EAEAEA !important;appearance: normal;">
											<option value="0">请选择省份</option>
											{volist name="areas_list" id="vo"}
												<option value="{$vo.id}">{$vo.name}</option>
											{/volist}
										</select>
									</li>

									<li>所在市
										<select class="select" id="city_china" name="CityId" style="margin-left: 15px;width:200px;height:40px;border: 1px solid #EAEAEA !important;appearance: normal;">
											<option value="0">请选择城市</option>
										</select>
									</li>

	                              
								</ul>
							</article>
							<button class="bdyhk_button" id="bank_btn" style="margin-top: 2rem;">完成</button>
							
						</main><br>
							<br>
							<br>
					</div>
				</div>
				<div class="mui-off-canvas-backdrop"></div>
			</div>
		</div>
		{include file="Public/footer"}
	</body>

<script>

	$("#pro_china").bind("change",function(){
		var cid = $(this).val();
		var url = "{:url('Account/city')}";
		$.post(url,{"cid":cid},function(data){
			$("#city_china").html(data.content);
		})
	});

    $("#bank_btn").click(function(){
    	var changbankno = $("#yhpd").val();
	    var addBankCode = $("#bankCode").val();
	    var bankAddress = $("#zhihang").val();
	    var ProvinceId = $("#pro_china").val();
	    var CityId = $("#city_china").val();

		if (!checkNumber(changbankno)) {
			layer.msg('请输入正确数字', {icon: 5, time: 2000});
			return false;
		}


		if(changbankno.length <16 || changbankno.length >19){
			layer.msg('银行卡号不合法,位数为'+changbankno.length, {icon: 5, time: 2000});
			return false;
		}


	    $.ajax({
			type:"post",
			url:'{:url("bd_bankcard")}',
			dataType:"json",
			data:{changbankno:changbankno,addBankCode:addBankCode,bankAddress:bankAddress,ProvinceId:ProvinceId,CityId:CityId},
			success: function(data){
				if(data.success == 1){
					layer.msg(data.msg, {icon: 6, time: 1000},function(){
	                    window.location.href = "{:url('bankcard')}";
	                });
				}else{
					layer.msg(data.msg, {icon: 5, time: 2000});
				}
			}
		});
    });

	//验证字符串是否是数字
	function checkNumber(theObj) {
		var reg = /(^[1-9]\d*$)/;
		if (reg.test(theObj)) {
			return true;
		}
		return false;
	}

    
</script>
</html>